package com.yanqu.road.server.manager.activity.commonsupport.handler;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public abstract class SupportActivityHandler {

    private static Map<Integer, SupportActivityHandler> handlerMap = new ConcurrentHashMap<>();

    /**
     * 商会是否在名单内
     * @param activityId 活动id
     * @param groupId  活动分组
     * @param unionUid 竞猜目标
     * @return
     */
    public boolean ableUnion(int activityId, int groupId, String unionUid){
        return false;
    }

    /**
     * 玩家是否有竞猜资格
     * @param activityId 活动id
     * @param groupId 活动分组
     * @param userId
     * @return
     */
    public boolean ableUser(int activityId, int groupId, long userId){
        return false;
    }

    public static void put(int type, SupportActivityHandler handler){
        handlerMap.put(type, handler);
    }

    public static SupportActivityHandler get(int type){
        SupportActivityHandler handler = handlerMap.get(type);
        if(handler == null){
            return new DefaultSupportActivityHandler();
        }
        return handler;
    }
}
